import logging
from xadmin.model import *
from xadmin.lib.base import *

log = logging.getLogger(__name__)

class ProjectController(BaseController):

    def create(self):
        # Return a rendered template
        #   return render('/some/template.mako')
        # or, Return a response
        return 'Hello World'

    def read(self):
        planXML="<plan></plan>"
        self.start_response('200 OK', [('Content-Type','text/xml')])
	projects = [project.name for project in Session.query(Project).all()]
        xml = '<?xml version="1.0" encoding="UTF-8" ?><projects>'
	for project in projects:
		xml += '<project>'
		xml += project
		xml += '</project>'
	xml += '</projects>'
        return xml
        tipo=""
	if request.params.__contains__('tipo'):
            tipo=request.params['tipo'].__str__()
            
        contenido=request.body.read(int(request.environ['CONTENT_LENGTH']))    

    def update(self):
        return 'Hello World'

    def delete(self):
        return 'Hello World'
        
    def nada(self):
        return 'Nada'
